/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


apuxin.Workplace = new Class({
   Implements: [Options, Events],

   options : {
       onStart: $empty()
   },

   windowsize: $(document.body).getSize(),

   initialize: function(options)
   {
        this.setOptions(options);
   },

   run: function()
   {
       new Asset.css('themes/standard/workplace.css');
       var workplace = new Element('div', {id: 'workspace'});
       workplace.setStyles({width: '100%', height: this.windowsize.y});
       $(document.body).adopt(workplace);

       window.addEvent('resize', function() {
           this.windowsize = $(document.body).getSize();
           workplace.setStyles({height: this.windowsize.y});
       });

       var tbar = new apuxin.Taskbar({barid: 'taskbar'});
       tbar.build();
   },

   addToWorkplace: function(el)
   {
       console.log($('workspace'));
       $('workspace').adopt(el);
   }
});

apuxin.Taskbar = new Class({
   Implements: [apuxin.Widget],

   options: {
       barid: 'taskbar'
   },

   initialize: function(options)
   {
       this.setOptions(options);
       
   },

   build: function()
   {
       this.mainelement = new Element('div', {id: this.options.barid});
       var leftcorner = new Element('div', {'id':'taskbarleftcorner'});
       var rightcorner = new Element('div', {'id':'taskbarrightcorner'});
       this.mainelement.adopt(rightcorner);
       this.mainelement.adopt(leftcorner);
       var content = new Element('div', {'id':'taskbarmiddle'});
       content.set('html', 'Taskbar');
       this.mainelement.setStyle('width', document.body.getSize().x-100);
       this.addToWorkplace();
       content.setStyle('width', this.mainelement.getSize().x-49);
       this.mainelement.adopt(content);
       
   }
});

wp = new apuxin.Workplace();
wp.run();